3bebb7
@@ -254,16 +254,16 @@
public static BigDecimal enforcePrecisionScale(BigDecimal bd, int maxPrecision,
       return null;
     }
 
+    if (bd.scale() > maxScale) {
+      bd = bd.setScale(maxScale, RoundingMode.HALF_UP);
+    }
+
     int maxIntDigits = maxPrecision - maxScale;
     int intDigits = bd.precision() - bd.scale();
     if (intDigits > maxIntDigits) {
       return null;
     }
 
-    if (bd.scale() > maxScale) {
-      bd = bd.setScale(maxScale, RoundingMode.HALF_UP);
-    }
-
     return bd;
   }
 }
